#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    ListNode* FindKthToTail(ListNode* pHead, int k)
    {
        if (pHead == nullptr)
            return nullptr;
        ListNode* last, * fast;
        last = fast = pHead;
        while (k--)
        {
            if (fast == nullptr)
                return nullptr;
            fast = fast->next;
        }
        while (fast != nullptr)
        {
            last = last->next;
            fast = fast->next;
        }
        return last;
    }
};

